package com.hazesoft.hdclib;

import android.os.AsyncTask;

public class BackgoundLayoutDownloader extends
		AsyncTask<Object, Void, Boolean> {

	@Override
	protected Boolean doInBackground(Object... params) {
		HazeLayoutDownloader tempDownloader = (HazeLayoutDownloader)params[0];
		boolean tempForce = (Boolean)params[1];
		Object tempDownloadParams = params[2];
		HazeComponentManager tempManager = (HazeComponentManager)params[3];
		
		if(tempDownloader == null)
			return false;
		
		tempDownloader.Prepare(tempManager, tempDownloadParams);
		if(tempForce)
		{
			return tempDownloader.Download(tempManager.GetLayoutPath());
		}
		else
		{
			if(tempDownloader.RequireDownload(tempManager.GetLayoutPath()))
			{
				return tempDownloader.Download(tempManager.GetLayoutPath());
			}
			else
			{
				return true;
			}
		}
	}

}
